<?php
class TemaController extends 
	Zend_Controller_Action 
	
{
	public function indexAction() 
	{
		
		$questionId = $this->_getParam('questionId');
		
		try {
			
			$mapper = Vs_Factory::mapper( 'Question' );
			$mapper2= Vs_Factory::mapper( 'ReasonFamily' );
			
			$question = $mapper->getById($questionId);
			
			$mapper->loadCategory($question);
			$mapper->loadCity($question);
			$mapper->loadReasonFamily($question);
			$mapper->loadAnswers ($question);
		
			$mapper2->loadReasons(
				$question->getReasonFamily()
			);
			
			
		} catch (Vs_Exception $e) {
		
			if( $e->getMessage() == Vs_Exception::QUESTION_NOT_FOUND ){
				
				return $this->_forward('not-found', 'error');
			} else {
				throw $e;
			}
			
		}
		
// 		Zend_Debug::dump($question);
// 		exit;
		
		$this->view->question = $question;
		$this->render( 'index' );
	}
	
	
	
	
	
}